% Author:
% Date: 2/19/2012

:- module(qasystem_count, [evaluatecount/3]).
:- use_module(data,[data/2]).

member(X, [X|_]).
member(X, [_|Tail]) :- member(X, Tail).

count( [], 0).
count( [_|Rest], N):- count(Rest, M), N is M +1.

apply(Functor, Argument, Result) :- Functor= lambda(Argument, Result).

evaluatecount(Expression, Result,Predicate):-
                             apply(Expression, X, Term),							 
                             data(Predicate,Model),                             
							 findall(Term, member(Term,Model),List),
							 count(List,Result).
							 

